package main

import (
	"github.com/ethereum/go-ethereum/common"
	"github.com/harmony-one/harmony/core/vm"
	"math/big"
	"strconv"
	"strings"
)

func main1() {
	value := big.NewInt(2684270475)
	hex := common.Bytes2Hex(value.Lsh(value, 224).Bytes())
	println(hex)
}

func main3() {
	hex := "0x95a759428f9a8b4bc02e20086085f32b7a440463"
	address := common.HexToAddress(hex)
	b := address.Big()
	println(b)
}

func main() {
	hex := "608060405234801561001057600080fd5b506004361061002b5760003560e01c80638e26a6e914610030575b600080fd5b61004a60048036038101906100459190610505565b610060565b6040516100579190610826565b60405180910390f35b600082518210610072578190506102d3565b60005b83838151811061008157fe5b602002602001015160600151518110156100ef576001808585815181106100a457fe5b60200260200101516060015183815181106100bb57fe5b60200260200101516040516100d091906107bf565b9081526020016040518091039020819055508080600101915050610075565b5060006001830190505b835181101561025157600084828151811061011057fe5b60200260200101519050838160200151141561024557600080549050816040015110610171576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161016890610806565b60405180910390fd5b60008082604001518154811061018357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16638e26a6e987856040518363ffffffff1660e01b81526004016101eb9291906107d6565b602060405180830381600087803b15801561020557600080fd5b505af1158015610219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023d9190610559565b92505061024b565b50610251565b506100f9565b60005b84848151811061026057fe5b602002602001015160600151518110156102cd57600185858151811061028257fe5b602002602001015160600151828151811061029957fe5b60200260200101516040516102ae91906107bf565b9081526020016040518091039020600090558080600101915050610254565b50809150505b92915050565b60006102ec6102e784610872565b610841565b9050808382526020820190508260005b8581101561032c57813585016103128882610425565b8452602084019350602083019250506001810190506102fc565b5050509392505050565b60006103496103448461089e565b610841565b9050808382526020820190508260005b85811015610389578135850161036f888261044f565b845260208401935060208301925050600181019050610359565b5050509392505050565b60006103a66103a1846108ca565b610841565b9050828152602081018484840111156103be57600080fd5b6103c98482856109ae565b509392505050565b600082601f8301126103e257600080fd5b81356103f28482602086016102d9565b91505092915050565b600082601f83011261040c57600080fd5b813561041c848260208601610336565b91505092915050565b600082601f83011261043657600080fd5b8135610446848260208601610393565b91505092915050565b60006080828403121561046157600080fd5b61046b6080610841565b9050600061047b848285016104db565b600083015250602061048f848285016104db565b60208301525060406104a3848285016104db565b604083015250606082013567ffffffffffffffff8111156104c357600080fd5b6104cf848285016103d1565b60608301525092915050565b6000813590506104ea81610a03565b92915050565b6000815190506104ff81610a03565b92915050565b6000806040838503121561051857600080fd5b600083013567ffffffffffffffff81111561053257600080fd5b61053e858286016103fb565b925050602061054f858286016104db565b9150509250929050565b60006020828403121561056b57600080fd5b6000610579848285016104f0565b91505092915050565b600061058e8383610694565b905092915050565b60006105a2838361073e565b905092915050565b60006105b58261091a565b6105bf8185610955565b9350836020820285016105d1856108fa565b8060005b8581101561060d57848403895281516105ee8582610582565b94506105f98361093b565b925060208a019950506001810190506105d5565b50829750879550505050505092915050565b600061062a82610925565b6106348185610966565b9350836020820285016106468561090a565b8060005b8581101561068257848403895281516106638582610596565b945061066e83610948565b925060208a0199505060018101905061064a565b50829750879550505050505092915050565b600061069f82610930565b6106a98185610977565b93506106b98185602086016109bd565b6106c2816109f2565b840191505092915050565b60006106d882610930565b6106e28185610999565b93506106f28185602086016109bd565b80840191505092915050565b600061070b600c83610988565b91507f77726f6e6720706172656e7400000000000000000000000000000000000000006000830152602082019050919050565b600060808301600083015161075660008601826107a1565b50602083015161076960208601826107a1565b50604083015161077c60408601826107a1565b506060830151848203606086015261079482826105aa565b9150508091505092915050565b6107aa816109a4565b82525050565b6107b9816109a4565b82525050565b60006107cb82846106cd565b915081905092915050565b600060408201905081810360008301526107f0818561061f565b90506107ff60208301846107b0565b9392505050565b6000602082019050818103600083015261081f816106fe565b9050919050565b600060208201905061083b60008301846107b0565b92915050565b6000604051905081810181811067ffffffffffffffff82111715610868576108676109f0565b5b8060405250919050565b600067ffffffffffffffff82111561088d5761088c6109f0565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156108b9576108b86109f0565b5b602082029050602081019050919050565b600067ffffffffffffffff8211156108e5576108e46109f0565b5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000819050919050565b82818337600083830152505050565b60005b838110156109db5780820151818401526020810190506109c0565b838111156109ea576000848401525b50505050565bfe5b6000601f19601f8301169050919050565b610a0c816109a4565b8114610a1757600080fd5b5056fea26469706673582212200c384c1e56c765c76fef50c870ba71f7bb1407d47387f5c3b3f562456d9511cb64736f6c63430007060033"
	bytes := common.Hex2Bytes(hex)
	opCodes := make([]string, 0)
	i := 0
	for i < len(bytes) {
		opCode := vm.OpCode(bytes[i])
		opCodes = append(opCodes, opCode.String())
		i++
		if value, found := strings.CutPrefix(opCode.String(), "PUSH"); found {
			pushLen, _ := strconv.Atoi(value)
			hexValue := "0x" + common.Bytes2Hex(bytes[i:i+pushLen])
			opCodes = append(opCodes, hexValue)
			for j := 0; j < pushLen-1; j++ {
				opCodes = append(opCodes, "")
			}
			i += pushLen
		}
	}
	println(strings.Join(opCodes, "\n"))
}
